home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2038 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.5 KB  |  39 lines

  1. Path: li.net!usenet
  2. From: bsilvern@li.net (Bob Silvern)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help!!! No outport, outportb in BC++4.5 /Win32???
  5. Date: Mon, 15 Jan 1996 07:03:41 GMT
  6. Organization: Harmony Graphics
  7. Message-ID: <4dcu8r$2k3@linet02.li.net>
  8. References: <4d2g4p$8t4@newsserver.rrzn.uni-hannover.de>
  9. NNTP-Posting-Host: lisuser53.li.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. wulff@nwfs.rz.fh-hannover.de (Stefan Wulff) wrote:
  13.  
  14. >It seems that there aren't the commands outport, outportb,... or 
  15. >something like this in BC++4.5 for Win32.
  16. >But i need them.
  17. >Please give me an advice!
  18. >Thanks.
  19. >Stefan.
  20.  
  21. I too found that pretty anoying.  I wrote these macros to ease the 16 to 32 bit
  22. transition.  They help, but use them cautiously because the directly manipulate
  23. the AX and DX registers.  The compiler won't realize your doing this, so it is
  24. posible that the compiler will try to use the value of these registers after
  25. you trash them.  You can fix this by starting each of the macros below with
  26. "push _AX; push _DX;" and ending each one with "pop _DX; pop _AX;" if execution
  27. time isn't critical and you want to be safe.  Mine was a real time application
  28. so I had to live dangerously.  
  29.  
  30. #ifdef WIN32 
  31.   #define MK_FP(a, b) (((a) << 16) + (b))
  32.   #define outportb(p, d) {_DX = p; _AL = d; asm out dx,al;}
  33.   #define outport(p, d)  {_DX = p; _AX = d; asm out dx,ax;}
  34.   #define inportb(p, d)  {_DX = p; asm in al,dx; d = _AL;}
  35.   #define inport(p, d)   {_DX = p; asm in ax,dx; d = _AX;}
  36. #endif
  37.  
  38.  
  39.